Skip to content

Refactor and optimize C++ JSON validator (MIIIIIW)#1

Open
MliliGenes wants to merge 1 commit intoHayoun01:mainfrom
MliliGenes:feature/code-optimizations
Open

Refactor and optimize C++ JSON validator (MIIIIIW)#1
MliliGenes wants to merge 1 commit intoHayoun01:mainfrom
MliliGenes:feature/code-optimizations

Conversation

@MliliGenes
Copy link

This commit introduces several improvements to the C++98 JSON parser and validator library.

  • Build System: Added a Makefile to automate the build process, replacing the manual compilation command. This also resolves an unconventional #include of a .cpp file.
  • Code Structure: Separated the schema definition into a header (schema.hpp) and implementation file (schema.cpp) for better modularity.
  • Code Quality:
    • Fixed compiler warnings by explicitly initializing the base class in all validator copy constructors.
    • Refactored the match_token_name function to use a switch statement for improved readability and performance.
  • Parser Robustness: Optimized the extract_json_types function to be more correct and robust by checking for keywords character-by-character and properly handling mismatches and stream state.

This commit introduces several improvements to the C++98 JSON parser and validator library.

- **Build System:** Added a Makefile to automate the build process, replacing the manual compilation command. This also resolves an unconventional `#include` of a .cpp file.
- **Code Structure:** Separated the schema definition into a header (`schema.hpp`) and implementation file (`schema.cpp`) for better modularity.
- **Code Quality:**
  - Fixed compiler warnings by explicitly initializing the base class in all validator copy constructors.
  - Refactored the `match_token_name` function to use a `switch` statement for improved readability and performance.
- **Parser Robustness:** Optimized the `extract_json_types` function to be more correct and robust by checking for keywords character-by-character and properly handling mismatches and stream state.
@Hayoun01
Copy link
Owner

Hayoun01 commented Sep 8, 2025

can you plz gitignore your objects 🐱

@MliliGenes
Copy link
Author

should be good, i am rebuilding this with C, cause c is better 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants